from integration.serce.searce_execl import Serce_Excel
from integration.serce.serce_login import Serce_Login
from integration.serce.serce_sign import Serce_integration


class Serce_Focus:
    def __init__(self, zhi, main_zhi):
        self.__dict__.update(main_zhi)
        super().__init__()
        self.focus(zhi)
        self.login()


    def focus(self,zhi):
        self.url_switch=zhi[5]
        self.serce_username=zhi[3]
        self.serce_password=zhi[4]
        self.Auth_Token=zhi[6]
        zhi = 'alarmsHandle_EXCEL'
        self.svn_path = self.db_manager.select_cookies(zhi)[0][-3]

    def login(self):
        self.can = Serce_Login(self.__dict__).serce_login_update()


    def select(self, select):
        if select == 1:
            self.serce_login()
        elif select == 2:
            self.serce_xls()

    def serce_login(self):
        Serce_integration(self.can.__dict__).response_seach()

    def serce_xls(self):  ###
        Serce_Excel(self.can.__dict__).response_excel()

